package com.yuven.appframework.widget.titlebar

import android.content.Context
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.yuven.appframework.R
import com.yuven.baselib.utils.ViewUtils

/**
 * 
 *
 * @author :        Yuven
 * @date :          2021/7/30 10:08 上午
 * @desc :
 */
open class DefaultTitleBarFactory : ITitleBar.Factory {
    var rootView:View? = null

    override fun createTitleBarView(context: Context): View? {
        rootView = View.inflate(context, R.layout.common_title_bar,null)
        return rootView
    }

    override fun getTitleTextView(context:Context): TextView? {
        return rootView?.findViewById(R.id.common_tv_title);
    }

    override fun getTitleIcon(context: Context?): ImageView? {
        return null
    }

    override fun getLeftTextView(context:Context): TextView? {
        return null
    }

    override fun getLeftIcon(context: Context): ImageView? {
        return rootView?.findViewById(R.id.common_tv_back);
    }

    override fun getRightTextView(context:Context): TextView? {
        return rootView?.findViewById(R.id.common_tv_right_title);
    }

    override fun getBottomLine(context: Context):View?{
        return null;
    }

    override fun getTitleBarHeight(): Int? {
        return ViewUtils.dip2px(56f);
    }

    override fun getRightIcon(context: Context): ImageView? {
        return rootView?.findViewById(R.id.common_iv_title_close)
    }
}